Skip to content

Commit

Permalink
open folder in queue works.
Browse files Browse the repository at this point in the history
  • Loading branch information
ponchio committed Nov 19, 2024
1 parent 0a6d8d0 commit c843e71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 15 additions & 1 deletion relightlab/queueitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include <QProgressBar>
#include <QMessageBox>
#include <QFileInfo>
#include <QDesktopServices>
#include <QUrl>

#include "task.h"
#include "../relight/httpserver.h"

Expand Down Expand Up @@ -63,9 +66,11 @@ QueueItem::QueueItem(Task *_task, QListWidget *parent): QListWidgetItem(parent)

folder = new QPushButton();
folder->setIcon(QIcon::fromTheme("folder"));
folder->setEnabled(false);
folder->setEnabled(true);
grid->addWidget(folder, 0, 3, 4, 1);

connect(folder, SIGNAL(clicked(bool)), this, SLOT(openFolder()));

widget->setLayout(grid);

setSizeHint(widget->minimumSizeHint());
Expand Down Expand Up @@ -94,6 +99,7 @@ void QueueItem::update() {
if(info.isDir())
cast->setEnabled(true);
}
cast->setEnabled(true);
break;
case Task::STOPPED:
status->setText("Stopped");
Expand Down Expand Up @@ -123,3 +129,11 @@ void QueueItem::casting() {
QMessageBox::critical(nullptr, "Could not cast!", error);
}
}

void QueueItem::openFolder() {
QFileInfo fileInfo(task->output);
QString path = fileInfo.isDir() ? fileInfo.absoluteFilePath() : fileInfo.absolutePath();

QUrl folderUrl = QUrl::fromLocalFile(path);
QDesktopServices::openUrl(folderUrl);
}
2 changes: 2 additions & 0 deletions relightlab/queueitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ class QueueItem: public QObject, public QListWidgetItem {

QueueItem(Task *task, QListWidget *parent);
void update();

public slots:
void setSelected(bool selected);
void progress(QString text, int percent);
void casting();
void openFolder();

private:
QMap<int, QString> style;
Expand Down

0 comments on commit c843e71

Please sign in to comment.