From 2f09b534d2139182fae46ad6d5f38c42512e3912 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Mon, 20 Aug 2018 11:00:34 -0400 Subject: [PATCH] save window dimensions between sessions --- GUI/mainwindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/GUI/mainwindow.cpp b/GUI/mainwindow.cpp index d8d6e32..43cd02f 100644 --- a/GUI/mainwindow.cpp +++ b/GUI/mainwindow.cpp @@ -55,6 +55,12 @@ MainWindow::MainWindow(QWidget *parent) : ttCombo = mainWindow->findChild("ttCombo"); extenCombo = mainWindow->findChild("extenCombo"); textOutput = mainWindow->findChild("textOutput"); + QFile settings("NHWindow"); + settings.open(QIODevice::ReadOnly); + QDataStream reader(&settings); + QRect rect = QRect(); + reader >> rect; + if (rect.bottom()) this->setGeometry(rect); hostSignaller->Initialize(); connect(hostSignaller, &HostSignaller::AddProcess, this, &MainWindow::AddProcess); @@ -69,6 +75,10 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { + QFile settings("NHWindow"); + settings.open(QIODevice::ReadWrite | QIODevice::Truncate); + QDataStream writer(&settings); + writer << this->geometry(); delete ui; } @@ -228,7 +238,7 @@ void MainWindow::on_saveButton_clicked() void MainWindow::on_ttCombo_activated(int index) { - textOutput->setPlainText(QString::fromWCharArray(Host::GetThread(ttCombo->itemText(index).split(":")[0].toInt())->GetStore().c_str())); + textOutput->setPlainText(QString::fromStdWString(Host::GetThread(ttCombo->itemText(index).split(":")[0].toInt())->GetStore())); textOutput->moveCursor(QTextCursor::End); }