File indexing completed on 2024-05-12 05:35:44

0001 /*
0002     SPDX-FileCopyrightText: 2011 Andriy Rysin <rysin@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QString>
0010 
0011 #include "x11_helper.h"
0012 
0013 class LayoutMemory;
0014 class QFile;
0015 
0016 class LayoutMemoryPersister
0017 {
0018 public:
0019     LayoutMemoryPersister(LayoutMemory &layoutMemory_)
0020         : layoutMemory(layoutMemory_)
0021     {
0022     }
0023 
0024     bool saveToFile(const QFile &file);
0025     bool restoreFromFile(const QFile &file);
0026 
0027     bool save();
0028     bool restore();
0029 
0030     LayoutUnit getGlobalLayout() const
0031     {
0032         return globalLayout;
0033     }
0034     void setGlobalLayout(const LayoutUnit &layout)
0035     {
0036         globalLayout = layout;
0037     }
0038 
0039 private:
0040     LayoutMemory &layoutMemory;
0041     LayoutUnit globalLayout;
0042 
0043     QString getLayoutMapAsString();
0044 
0045     bool canPersist();
0046 };