Skip to content
Snippets Groups Projects
Commit 3a0ab2b2 authored by Karsten Rink's avatar Karsten Rink
Browse files

Merge pull request #558 from norihiro-w/support-gui-arg

[DataExplorer] automatically load a file given as a command line argument
parents 5c93bde7 2e6d7717
No related branches found
No related tags found
No related merge requests found
...@@ -37,6 +37,9 @@ int main(int argc, char* argv[]) ...@@ -37,6 +37,9 @@ int main(int argc, char* argv[])
MainWindow* w = new MainWindow(); MainWindow* w = new MainWindow();
w->setWindowTitle( w->windowTitle() + " - " + w->setWindowTitle( w->windowTitle() + " - " +
QString::fromStdString(BaseLib::BuildInfo::git_describe)); QString::fromStdString(BaseLib::BuildInfo::git_describe));
if (QCoreApplication::arguments().size()>1) {
w->loadFileOnStartUp(QCoreApplication::arguments().at(1));
}
w->show(); w->show();
int returncode = a.exec(); int returncode = a.exec();
delete w; delete w;
......
...@@ -1096,6 +1096,14 @@ void MainWindow::HideWindow() ...@@ -1096,6 +1096,14 @@ void MainWindow::HideWindow()
this->hide(); this->hide();
} }
void MainWindow::loadFileOnStartUp(const QString &fileName)
{
QString ext = QFileInfo(fileName).suffix();
if (ext=="msh" || ext=="vtu" || ext=="gli" || ext=="gml") {
this->loadFile(ImportFileType::OGS,fileName);
}
}
void MainWindow::on_actionExportVTK_triggered(bool checked /*= false*/) void MainWindow::on_actionExportVTK_triggered(bool checked /*= false*/)
{ {
Q_UNUSED(checked) Q_UNUSED(checked)
......
...@@ -45,6 +45,7 @@ public: ...@@ -45,6 +45,7 @@ public:
void ShowWindow(); void ShowWindow();
void HideWindow(); void HideWindow();
void loadFileOnStartUp(const QString &fileName);
protected: protected:
void closeEvent( QCloseEvent* event ); void closeEvent( QCloseEvent* event );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment