Ostinato starts with session file if provided on command line

This commit is contained in:
Srivats P 2016-10-13 22:06:11 +05:30
parent 708aed9135
commit b45720b566
2 changed files with 17 additions and 4 deletions

View File

@ -120,6 +120,16 @@ MainWindow::MainWindow(QWidget *parent)
connect(updater, SIGNAL(newVersionAvailable(QString)),
this, SLOT(onNewVersion(QString)));
updater->checkForNewVersion();
if (appParams.argumentCount()) {
QString fileName = appParams.argument(0);
if (QFile::exists(fileName))
on_actionOpenSession_triggered(fileName);
else
QMessageBox::information(NULL, qApp->applicationName(),
QString("File not found: " + fileName));
}
#if 0
{
DbgThread *dbg = new DbgThread(pgl);
@ -151,18 +161,20 @@ MainWindow::~MainWindow()
}
}
void MainWindow::on_actionOpenSession_triggered()
void MainWindow::on_actionOpenSession_triggered(QString fileName)
{
qDebug("Open Session Action");
qDebug("Open Session Action (%s)", qPrintable(fileName));
static QString dirName;
QString fileName;
QStringList fileTypes = SessionFileFormat::supportedFileTypes(
SessionFileFormat::kOpenFile);
QString fileType;
QString errorStr;
bool ret;
if (!fileName.isEmpty())
goto _skip_prompt;
if (portsWindow->portGroupCount()) {
if (QMessageBox::question(this,
tr("Open Session"),
@ -180,6 +192,7 @@ void MainWindow::on_actionOpenSession_triggered()
if (fileName.isEmpty())
goto _exit;
_skip_prompt:
ret = openSession(fileName, errorStr);
if (!ret || !errorStr.isEmpty()) {
QMessageBox msgBox(this);

View File

@ -51,7 +51,7 @@ public:
~MainWindow();
public slots:
void on_actionOpenSession_triggered();
void on_actionOpenSession_triggered(QString fileName = QString());
void on_actionSaveSession_triggered();
void on_actionPreferences_triggered();
void on_actionViewRestoreDefaults_triggered();