File indexing completed on 2022-09-27 16:37:28

0001 // SPDX-FileCopyrightText: 2022 Felipe Kinoshita <kinofhek@gmail.com>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 #include <QQuickWindow>
0005 
0006 #include <KConfig>
0007 #include <KConfigGroup>
0008 #include <KWindowConfig>
0009 
0010 #include "controller.h"
0011 
0012 Controller::Controller(QObject *parent)
0013     : QObject(parent)
0014 {
0015 }
0016 
0017 Controller::~Controller()
0018 {
0019 }
0020 
0021 void Controller::restoreWindowGeometry(QQuickWindow *window)
0022 {
0023     KConfig dataResource("data", KConfig::SimpleConfig, QStandardPaths::AppDataLocation);
0024     KConfigGroup windowGroup(&dataResource, "Window");
0025     KWindowConfig::restoreWindowSize(window, windowGroup);
0026     KWindowConfig::restoreWindowPosition(window, windowGroup);
0027 }
0028 
0029 void Controller::saveWindowGeometry(QQuickWindow *window)
0030 {
0031     KConfig dataResource("data", KConfig::SimpleConfig, QStandardPaths::AppDataLocation);
0032     KConfigGroup windowGroup(&dataResource, "Window");
0033     KWindowConfig::saveWindowPosition(window, windowGroup);
0034     KWindowConfig::saveWindowSize(window, windowGroup);
0035     dataResource.sync();
0036 }