comparison 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
comparison
equal deleted inserted replaced
235:593108b3d555 236:4d461ef7d424
16 #include <QDropEvent> 16 #include <QDropEvent>
17 #include <QMimeData> 17 #include <QMimeData>
18 18
19 #include <algorithm> 19 #include <algorithm>
20 #include <iostream> 20 #include <iostream>
21
22 class DroppableListWidget : public QListWidget {
23 Q_OBJECT
24
25 public:
26 explicit DroppableListWidget(QWidget* parent);
27
28 signals:
29 void FilesDropped(QStringList list);
30
31 protected:
32 void dragEnterEvent(QDragEnterEvent* event) override;
33 void dragMoveEvent(QDragMoveEvent* event) override;
34 void dropEvent(QDropEvent* event) override;
35 };
36 21
37 DroppableListWidget::DroppableListWidget(QWidget* parent) : QListWidget(parent) { 22 DroppableListWidget::DroppableListWidget(QWidget* parent) : QListWidget(parent) {
38 setAcceptDrops(true); 23 setAcceptDrops(true);
39 } 24 }
40 25
127 connect(button, &QPushButton::clicked, this, [this, listwidget]{ 112 connect(button, &QPushButton::clicked, this, [this, listwidget]{
128 const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), 113 const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
129 QDir::homePath(), 114 QDir::homePath(),
130 QFileDialog::ShowDirsOnly 115 QFileDialog::ShowDirsOnly
131 | QFileDialog::DontResolveSymlinks); 116 | QFileDialog::DontResolveSymlinks);
132 if (dir.isEmpty()) 117 const std::string s_dir = Strings::ToUtf8String(dir);
118 if (dir.isEmpty() || paths.count(s_dir))
133 return; 119 return;
134 paths.insert(Strings::ToUtf8String(dir)); 120
121 paths.insert(s_dir);
135 QListWidgetItem* item = new QListWidgetItem(listwidget); 122 QListWidgetItem* item = new QListWidgetItem(listwidget);
136 item->setText(dir); 123 item->setText(dir);
137 }); 124 });
138 125
139 widget_layout->addWidget(button); 126 widget_layout->addWidget(button);
200 : SettingsPage(parent, tr("Library")), 187 : SettingsPage(parent, tr("Library")),
201 paths(session.config.library.paths) { 188 paths(session.config.library.paths) {
202 real_time_monitor = session.config.library.real_time_monitor; 189 real_time_monitor = session.config.library.real_time_monitor;
203 AddTab(CreateFoldersWidget(), tr("Folder")); 190 AddTab(CreateFoldersWidget(), tr("Folder"));
204 } 191 }
205
206 #include "gui/dialog/settings/library.moc"