diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-13 15:44:09 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-04-13 15:44:09 +0300 |
commit | 396bc0c1721af8d3ee970228e7df457f6b2c73d5 (patch) | |
tree | 5aee4f0faec3fdfe616e1684dcb1736be9126bc1 /src/session/savesessiondialog.cpp | |
parent | Add singleapplication.wrap (diff) | |
download | smolbote-396bc0c1721af8d3ee970228e7df457f6b2c73d5.tar.xz |
Rewrite Session backend
Add session.hpp, containing structs that describe session data
MainWindow, SubWindow and WebView can be created from
Session::structs
Opening new window will automatically open a default subwindow and tab
if none were specified
Add lib/session_formats
Add JsonSession, to serialize/deserialize Session structs into JSON
- add some tests
clang-tidy:
- fix various warnings
- disable modernize-use-trailing-return-type check
Diffstat (limited to 'src/session/savesessiondialog.cpp')
-rw-r--r-- | src/session/savesessiondialog.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/session/savesessiondialog.cpp b/src/session/savesessiondialog.cpp index 507cddb..ff5e696 100644 --- a/src/session/savesessiondialog.cpp +++ b/src/session/savesessiondialog.cpp @@ -1,7 +1,7 @@ /* * This file is part of smolbote. It's copyrighted by the contributors recorded * in the version control history of the file, available from its original - * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote + * location: https://library.iserlohn-fortress.net/aqua/smolbote.git * * SPDX-License-Identifier: GPL-3.0 */ @@ -9,6 +9,7 @@ #include "savesessiondialog.h" #include "browser.h" #include "mainwindow/mainwindow.h" +#include "session_json.hpp" #include "subwindow/subwindow.h" #include "ui_savesessiondialog.h" #include "webengine/webprofilemanager.h" @@ -61,18 +62,17 @@ void SaveSessionDialog::save(const QString &sessionPath) QFile output(filename); if(output.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { - QVector<MainWindow *> windows; + QVector<Session::MainWindow> windows; for(int i = 0; i < ui->treeWidget->topLevelItemCount(); ++i) { QTreeWidgetItem *item = ui->treeWidget->topLevelItem(i); if(item->checkState(0) == Qt::Checked) { auto *window = static_cast<MainWindow *>(item->data(0, Qt::UserRole).value<void *>()); - Q_CHECK_PTR(window); - windows.append(window); + windows.append(window->serialize()); } } - auto data = Session::_session(windows); - output.write(QJsonDocument(data).toJson()); + JsonSession session(windows); + output.write(session.serialize()); output.close(); } } |