Implemented window size and position tracking for the forms that are currently implemented and working

This commit is contained in:
Collin Kidder
2015-06-28 18:55:46 -04:00
parent 821e681dcd
commit 6c967d2071
16 changed files with 253 additions and 0 deletions
+30
View File
@@ -1,12 +1,16 @@
#include "filecomparatorwindow.h"
#include "ui_filecomparatorwindow.h"
#include <QSettings>
FileComparatorWindow::FileComparatorWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::FileComparatorWindow)
{
ui->setupUi(this);
readSettings();
connect(ui->btnFirstFile, SIGNAL(clicked(bool)), this, SLOT(loadFirstFile()));
connect(ui->btnSecondFile, SIGNAL(clicked(bool)), this, SLOT(loadSecondFile()));
connect(ui->btnSaveDetails, SIGNAL(clicked(bool)), this, SLOT(saveDetails()));
@@ -20,6 +24,32 @@ FileComparatorWindow::~FileComparatorWindow()
delete ui;
}
void FileComparatorWindow::closeEvent(QCloseEvent *event)
{
writeSettings();
}
void FileComparatorWindow::readSettings()
{
QSettings settings;
if (settings.value("Main/SaveRestorePositions", false).toBool())
{
resize(settings.value("FileComparator/WindowSize", QSize(720, 631)).toSize());
move(settings.value("FileComparator/WindowPos", QPoint(50, 50)).toPoint());
}
}
void FileComparatorWindow::writeSettings()
{
QSettings settings;
if (settings.value("Main/SaveRestorePositions", false).toBool())
{
settings.setValue("FileComparator/WindowSize", size());
settings.setValue("FileComparator/WindowPos", pos());
}
}
void FileComparatorWindow::loadFirstFile()
{
firstFileFrames.clear();