|
4 | 4 | #include "recentprojects.h"
|
5 | 5 | #include "mainwindow.h"
|
6 | 6 | #include "preferences.h"
|
| 7 | +#include "../relight/httpserver.h" |
7 | 8 |
|
8 | 9 | #include <QMessageBox>
|
9 | 10 | #include <QFileDialog>
|
@@ -104,7 +105,7 @@ RelightApp::RelightApp(int &argc, char **argv): QApplication(argc, argv) {
|
104 | 105 | addAction("show_list", "Show list", "list", "");
|
105 | 106 | addAction("show_grid", "Show grid", "grid", "");
|
106 | 107 |
|
107 |
| - addAction("view_rti", "View RTI", "cast", ""); |
| 108 | + addAction("view_rti", "View RTI in browser", "cast", "", SLOT(rtiView())); |
108 | 109 |
|
109 | 110 | addAction("help", "Help", "help-circle", "");
|
110 | 111 | addAction("about", "About", "info", "");
|
@@ -352,6 +353,29 @@ void RelightApp::loadThumbnails() {
|
352 | 353 |
|
353 | 354 | }
|
354 | 355 |
|
| 356 | +void RelightApp::rtiView() { |
| 357 | + QString last = lastViewDir(); |
| 358 | + QString dirname = QFileDialog::getExistingDirectory(nullptr, "Select a folder containing an RTI in relight format: json and jpeg", last); |
| 359 | + if(dirname.isNull()) |
| 360 | + return; |
| 361 | + QDir dir(dirname); |
| 362 | + QFileInfo info(dir.filePath("info.json")); |
| 363 | + if(!info.exists()) { |
| 364 | + QMessageBox::warning(nullptr, "Could not open relight folder", "It seems this folder do not contains an rti in relight format"); |
| 365 | + return; |
| 366 | + } |
| 367 | + setLastViewDir(dirname); |
| 368 | + try { |
| 369 | + HttpServer &server = HttpServer::instance(); |
| 370 | + server.stop(); |
| 371 | + server.port = 8880; |
| 372 | + server.start(dirname); |
| 373 | + server.show(); |
| 374 | + } catch(QString error) { |
| 375 | + QMessageBox::critical(nullptr, "Could not cast!", error); |
| 376 | + } |
| 377 | +} |
| 378 | + |
355 | 379 | void RelightApp::openPreferences() {
|
356 | 380 | if(!preferences)
|
357 | 381 | preferences = new Preferences(mainwindow);
|
|
0 commit comments