Q3270
A Qt-based 3270 Terminal Emulator
Loading...
Searching...
No Matches
SessionStore.h
1/*
2 * Q3270 Terminal Emulator
3 *
4 * Copyright (c) 2020–2025 Andy Styles
5 * SPDX-License-Identifier: BSD-3-Clause
6 *
7 * This file is part of Q3270.
8 * See the LICENSE file in the project root for full license information.
9 */
10
11#ifndef SESSIONSTORE_H
12#define SESSIONSTORE_H
13
14#include <QSettings>
15
16#include "Models/Session.h"
17#include "ActiveSettings.h"
18
20
21 public:
23
24 void load();
25
26 QList<Session> listSessions() const;
27 Session getSession(const QString &name) const;
28
29
30
31
32
33 QStringList listSessionNames() const;
34
35 bool saveSession(const Session &session);
36 void deleteSession(const QString &name);
37
38 QStringList listAutoStartSessions() const;
39 bool saveAutoStartSessions(const QStringList &names);
40
41 private:
42 mutable QSettings settings;
43
44 static Session fromActive(const ActiveSettings &active, const QString &name);
45 static void toActive(const Session &session, ActiveSettings &active);
46
47 QMap<QString, Session> sessions;
48};
49
50#endif // SESSIONSTORE_H
Definition ActiveSettings.h:20
Definition SessionStore.h:19
QStringList listSessionNames() const
listSessionNames Lists all session names in the store.
Definition SessionStore.cpp:184
Session getSession(const QString &name) const
getSession Retrieves a session by name.
Definition SessionStore.cpp:99
void load()
load Loads sessions from persistent storage into the store.
Definition SessionStore.cpp:35
QStringList listAutoStartSessions() const
listAutoStartSessions Lists all auto-start session names.
Definition SessionStore.cpp:225
QList< Session > listSessions() const
listSessions Lists all sessions in the store.
Definition SessionStore.cpp:165
SessionStore()
SessionStore constructor.
Definition SessionStore.cpp:23
bool saveSession(const Session &session)
saveSession Saves a session to persistent storage.
Definition SessionStore.cpp:112
bool saveAutoStartSessions(const QStringList &names)
saveAutoStartSessions Saves the list of auto-start session names.
Definition SessionStore.cpp:254
void deleteSession(const QString &name)
deleteSession Deletes a session from persistent storage.
Definition SessionStore.cpp:207
Definition Session.h:21