Skip to content

Commit

Permalink
Attempt to reopen last device on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
bweir committed May 11, 2016
1 parent 4a17527 commit 6498959
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/propelleride/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,18 @@ MainWindow::MainWindow(QWidget *parent)
manager.enablePortMonitor(true);
updatePorts();


QSettings settings;
QString lastport = settings.value("lastPort", QString()).toString();
if (!lastport.isEmpty())
{
int index = cbPort->findText(lastport);
if (index != -1)
cbPort->setCurrentIndex(index);
}



ui.editorTabs->newFile();
loadSession();

Expand All @@ -145,6 +157,7 @@ MainWindow::MainWindow(QWidget *parent)
statusBar();
}


void MainWindow::loadSession()
{
QSettings settings;
Expand Down Expand Up @@ -226,7 +239,9 @@ void MainWindow::closeEvent(QCloseEvent *e)
return;
}

QSettings().setValue("windowSize",saveGeometry());
QSettings settings;
settings.setValue("lastPort", cbPort->currentText());
settings.setValue("windowSize", saveGeometry());

if(e) e->accept();
qApp->exit(0);
Expand Down

0 comments on commit 6498959

Please sign in to comment.