annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include "core/session.h"
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include "core/strings.h"
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3 #include "gui/dialog/settings.h"
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
5 #include <QCheckBox>
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
6 #include <QDir>
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
7 #include <QDropEvent>
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
8 #include <QFileDialog>
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
9 #include <QFileInfo>
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
10 #include <QGroupBox>
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
11 #include <QLabel>
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 #include <QListWidget>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 #include <QListWidgetItem>
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
14 #include <QMimeData>
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
15 #include <QPushButton>
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 #include <QSizePolicy>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 #include <QVBoxLayout>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 #include <algorithm>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 #include <iostream>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22 DroppableListWidget::DroppableListWidget(QWidget* parent) : QListWidget(parent) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 setAcceptDrops(true);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
26 void DroppableListWidget::dragMoveEvent(QDragMoveEvent* event) {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
27 if (event->mimeData()->hasUrls())
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
28 event->acceptProposedAction();
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
29 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
30
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
31 void DroppableListWidget::dragEnterEvent(QDragEnterEvent* event) {
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
32 if (event->mimeData()->hasUrls())
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
33 event->acceptProposedAction();
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36 void DroppableListWidget::dropEvent(QDropEvent* event) {
228
d030b30526d5 config: remove unused username parameter from anilist auth
Paper <mrpapersonic@gmail.com>
parents: 226
diff changeset
37 const QMimeData* mime_data = event->mimeData();
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39 if (!mime_data->hasUrls())
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
40 return;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42 QStringList path_list;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43 QList<QUrl> url_list = mime_data->urls();
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
44
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45 for (const auto& url : url_list) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46 if (!url.isLocalFile())
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
47 continue;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
48
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
49 const QString file = url.toLocalFile();
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
50 const QFileInfo fileinfo(file);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
51 if (fileinfo.exists() && fileinfo.isDir())
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
52 path_list.append(file);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
53 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
54
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
55 if (!path_list.isEmpty())
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
56 emit FilesDropped(path_list);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
57
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
58 event->acceptProposedAction();
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
59 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
60
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
61 QWidget* SettingsPageLibrary::CreateFoldersWidget() {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
62 QWidget* result = new QWidget(this);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
63 result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
64
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
65 QVBoxLayout* full_layout = new QVBoxLayout(result);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
66
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
67 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
68 QGroupBox* group_box = new QGroupBox(tr("Library folders"), result);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
69 group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
70
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
71 QVBoxLayout* group_box_layout = new QVBoxLayout(group_box);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
72
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
73 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
74 QLabel* label = new QLabel(tr("These folders will be scanned and monitored for new episodes."), group_box);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
75 group_box_layout->addWidget(label);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
76 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
77
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
78 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
79 DroppableListWidget* listwidget = new DroppableListWidget(group_box);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
80 listwidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
81
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
82 for (const auto& path : paths) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
83 QListWidgetItem* item = new QListWidgetItem(listwidget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
84 item->setText(Strings::ToQString(path));
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
85 /* add icons as well soon */
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
86 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
87
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
88 connect(listwidget, &DroppableListWidget::FilesDropped, this, [this, listwidget](QStringList list) {
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89 for (const auto& dir : list) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
90 paths.insert(Strings::ToUtf8String(dir));
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
91 QListWidgetItem* item = new QListWidgetItem(listwidget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
92 item->setText(dir);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
93 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94 });
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
95
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
96 group_box_layout->addWidget(listwidget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
97
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
98 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
99 QWidget* widget = new QWidget(group_box);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
100 QHBoxLayout* widget_layout = new QHBoxLayout(widget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
101
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
102 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
103 QLabel* label = new QLabel(tr("Tip: You can drag and drop folders here."), widget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
104 widget_layout->addWidget(label);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
105 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
106
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
107 widget_layout->addStretch();
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
108
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
109 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
110 QPushButton* button = new QPushButton(tr("Add new..."), widget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
111
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
112 connect(button, &QPushButton::clicked, this, [this, listwidget] {
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
113 const QString dir = QFileDialog::getExistingDirectory(
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
114 this, tr("Open Directory"), QDir::homePath(),
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
115 QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
236
4d461ef7d424 HUGE UPDATE: convert build system to autotools
Paper <mrpapersonic@gmail.com>
parents: 232
diff changeset
116 const std::string s_dir = Strings::ToUtf8String(dir);
4d461ef7d424 HUGE UPDATE: convert build system to autotools
Paper <mrpapersonic@gmail.com>
parents: 232
diff changeset
117 if (dir.isEmpty() || paths.count(s_dir))
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
118 return;
236
4d461ef7d424 HUGE UPDATE: convert build system to autotools
Paper <mrpapersonic@gmail.com>
parents: 232
diff changeset
119
4d461ef7d424 HUGE UPDATE: convert build system to autotools
Paper <mrpapersonic@gmail.com>
parents: 232
diff changeset
120 paths.insert(s_dir);
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
121 QListWidgetItem* item = new QListWidgetItem(listwidget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
122 item->setText(dir);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
123 });
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
124
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
125 widget_layout->addWidget(button);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
126 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
127
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
128 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
129 QPushButton* button = new QPushButton(tr("Remove"), widget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
130
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
131 connect(listwidget, &QListWidget::itemSelectionChanged, this, [button, listwidget] {
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
132 QList<QListWidgetItem*> selection = listwidget->selectedItems();
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
133 button->setEnabled(selection.size() > 0);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
134 });
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
135
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
136 connect(button, &QPushButton::clicked, this, [this, listwidget] {
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
137 QList<QListWidgetItem*> selection = listwidget->selectedItems();
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
138 for (const auto& item : selection) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
139 paths.erase(Strings::ToUtf8String(item->text()));
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
140 delete item;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
141 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
142 });
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
143
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
144 widget_layout->addWidget(button);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
145 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
146
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
147 group_box_layout->addWidget(widget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
148 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
149 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
150
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
151 full_layout->addWidget(group_box);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
152 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
153
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
154 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
155 QGroupBox* group_box = new QGroupBox(tr("Real-time monitor"), result);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
156 group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
157
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
158 QVBoxLayout* group_box_layout = new QVBoxLayout(group_box);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
159
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
160 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
161 QCheckBox* checkbox = new QCheckBox(tr("Detect new files and folders under library folders"), group_box);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
162 checkbox->setCheckState(real_time_monitor ? Qt::Checked : Qt::Unchecked);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
163
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
164 connect(checkbox, &QCheckBox::stateChanged, this,
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
165 [this](int state) { real_time_monitor = (state != Qt::Unchecked); });
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
166
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
167 group_box_layout->addWidget(checkbox);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
168 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
169
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
170 full_layout->addWidget(group_box);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
171 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
172
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
173 full_layout->setSpacing(10);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
174 full_layout->addStretch();
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
175
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
176 return result;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
177 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
178
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
179 void SettingsPageLibrary::SaveInfo() {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
180 session.config.library.paths = paths;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
181 session.config.library.real_time_monitor = real_time_monitor;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
182 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
183
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
184 SettingsPageLibrary::SettingsPageLibrary(QWidget* parent)
258
862d0d8619f6 *: HUUUGE changes
Paper <paper@paper.us.eu.org>
parents: 236
diff changeset
185 : SettingsPage(parent, tr("Library")), paths(session.config.library.paths) {
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
186 real_time_monitor = session.config.library.real_time_monitor;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
187 AddTab(CreateFoldersWidget(), tr("Folder"));
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
188 }