annotate src/gui/dialog/settings/library.cc @ 236:4d461ef7d424

HUGE UPDATE: convert build system to autotools why? because cmake sucks :)
author Paper <mrpapersonic@gmail.com>
date Fri, 19 Jan 2024 00:24:02 -0500
parents ff0061e75f0f
children 862d0d8619f6
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
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include <QListWidget>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 #include <QListWidgetItem>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 #include <QGroupBox>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 #include <QCheckBox>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9 #include <QLabel>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 #include <QSizePolicy>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 #include <QVBoxLayout>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
12 #include <QDir>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 #include <QFileDialog>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 #include <QFileInfo>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 #include <QPushButton>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 #include <QDropEvent>
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 #include <QMimeData>
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) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
27 if (event->mimeData()->hasUrls())
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
28 event->acceptProposedAction();
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) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
32 if (event->mimeData()->hasUrls())
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 event->acceptProposedAction();
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
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
88 connect(listwidget, &DroppableListWidget::FilesDropped, this, [this, listwidget](QStringList list){
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
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
112 connect(button, &QPushButton::clicked, this, [this, listwidget]{
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
113 const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
114 QDir::homePath(),
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
115 QFileDialog::ShowDirsOnly
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
116 | QFileDialog::DontResolveSymlinks);
236
4d461ef7d424 HUGE UPDATE: convert build system to autotools
Paper <mrpapersonic@gmail.com>
parents: 232
diff changeset
117 const std::string s_dir = Strings::ToUtf8String(dir);
4d461ef7d424 HUGE UPDATE: convert build system to autotools
Paper <mrpapersonic@gmail.com>
parents: 232
diff changeset
118 if (dir.isEmpty() || paths.count(s_dir))
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
119 return;
236
4d461ef7d424 HUGE UPDATE: convert build system to autotools
Paper <mrpapersonic@gmail.com>
parents: 232
diff changeset
120
4d461ef7d424 HUGE UPDATE: convert build system to autotools
Paper <mrpapersonic@gmail.com>
parents: 232
diff changeset
121 paths.insert(s_dir);
226
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
122 QListWidgetItem* item = new QListWidgetItem(listwidget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
123 item->setText(dir);
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
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
126 widget_layout->addWidget(button);
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 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
130 QPushButton* button = new QPushButton(tr("Remove"), widget);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
131
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
132 connect(listwidget, &QListWidget::itemSelectionChanged, this, [button, listwidget]{
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
133 QList<QListWidgetItem*> selection = listwidget->selectedItems();
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
134 button->setEnabled(selection.size() > 0);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
135 });
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
136
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
137 connect(button, &QPushButton::clicked, this, [this, listwidget]{
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
138 QList<QListWidgetItem*> selection = listwidget->selectedItems();
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
139 for (const auto& item : selection) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
140 paths.erase(Strings::ToUtf8String(item->text()));
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
141 delete item;
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
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
145 widget_layout->addWidget(button);
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
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
148 group_box_layout->addWidget(widget);
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
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
152 full_layout->addWidget(group_box);
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 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
156 QGroupBox* group_box = new QGroupBox(tr("Real-time monitor"), result);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
157 group_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
158
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
159 QVBoxLayout* group_box_layout = new QVBoxLayout(group_box);
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 {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
162 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
163 checkbox->setCheckState(real_time_monitor ? Qt::Checked : Qt::Unchecked);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
164
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
165 connect(checkbox, &QCheckBox::stateChanged, this, [this](int state) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
166 real_time_monitor = (state != Qt::Unchecked);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
167 });
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 group_box_layout->addWidget(checkbox);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
170 }
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 full_layout->addWidget(group_box);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
173 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
174
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
175 full_layout->setSpacing(10);
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
176 full_layout->addStretch();
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 return result;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
179 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
180
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
181 void SettingsPageLibrary::SaveInfo() {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
182 session.config.library.paths = paths;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
183 session.config.library.real_time_monitor = real_time_monitor;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
184 }
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
185
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
186 SettingsPageLibrary::SettingsPageLibrary(QWidget* parent)
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
187 : SettingsPage(parent, tr("Library")),
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
188 paths(session.config.library.paths) {
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
189 real_time_monitor = session.config.library.real_time_monitor;
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
190 AddTab(CreateFoldersWidget(), tr("Folder"));
f784b5b1914c settings: add library page
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
191 }