Skip to content

Commit

Permalink
implement a --load command line option
Browse files Browse the repository at this point in the history
  • Loading branch information
toloudis committed May 11, 2024
1 parent c3d2d03 commit c1e7873
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion agave_app/agaveGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ class agaveGui : public QMainWindow
public:
agaveGui(QWidget* parent = Q_NULLPTR);

bool open(const std::string& file, const Serialize::ViewerState* vs = nullptr);

private:
Ui::agaveGuiClass m_ui;

bool open(const std::string& file, const Serialize::ViewerState* vs = nullptr);
void onImageLoaded(std::shared_ptr<ImageXYZC> image,
const LoadSpec& loadSpec,
uint32_t sizeT,
Expand Down
10 changes: 10 additions & 0 deletions agave_app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ main(int argc, char* argv[])
QCommandLineOption serverOption("server",
QCoreApplication::translate("main", "Run as websocket server without GUI."));
parser.addOption(serverOption);

QCommandLineOption loadOption("load",
QCoreApplication::translate("main", "File or url to load."),
QCoreApplication::translate("main", "fileToLoad"));
parser.addOption(loadOption);

QCommandLineOption listDevicesOption(
"list_devices", QCoreApplication::translate("main", "Log the known EGL devices (only valid in --server mode)."));
parser.addOption(listDevicesOption);
Expand All @@ -135,6 +141,7 @@ main(int argc, char* argv[])
bool isServer = parser.isSet(serverOption);
bool listDevices = parser.isSet(listDevicesOption);
int selectedGpu = parser.value(selectGpuOption).toInt();
QString fileToLoad = parser.value(loadOption);

QString appPath = QCoreApplication::applicationDirPath();
std::string appPathStr = appPath.toStdString();
Expand Down Expand Up @@ -178,6 +185,9 @@ main(int argc, char* argv[])
} else {
agaveGui* w = new agaveGui();
w->show();
if (!fileToLoad.isEmpty()) {
w->open(fileToLoad.toStdString());
}
result = a.exec();
}
} catch (const std::exception& exc) {
Expand Down

0 comments on commit c1e7873

Please sign in to comment.