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)), connect(updater, SIGNAL(newVersionAvailable(QString)),
this, SLOT(onNewVersion(QString))); this, SLOT(onNewVersion(QString)));
updater->checkForNewVersion(); 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 #if 0
{ {
DbgThread *dbg = new DbgThread(pgl); 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; static QString dirName;
QString fileName;
QStringList fileTypes = SessionFileFormat::supportedFileTypes( QStringList fileTypes = SessionFileFormat::supportedFileTypes(
SessionFileFormat::kOpenFile); SessionFileFormat::kOpenFile);
QString fileType; QString fileType;
QString errorStr; QString errorStr;
bool ret; bool ret;
if (!fileName.isEmpty())
goto _skip_prompt;
if (portsWindow->portGroupCount()) { if (portsWindow->portGroupCount()) {
if (QMessageBox::question(this, if (QMessageBox::question(this,
tr("Open Session"), tr("Open Session"),
@ -180,6 +192,7 @@ void MainWindow::on_actionOpenSession_triggered()
if (fileName.isEmpty()) if (fileName.isEmpty())
goto _exit; goto _exit;
_skip_prompt:
ret = openSession(fileName, errorStr); ret = openSession(fileName, errorStr);
if (!ret || !errorStr.isEmpty()) { if (!ret || !errorStr.isEmpty()) {
QMessageBox msgBox(this); QMessageBox msgBox(this);

View File

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