add default session path

This commit is contained in:
2020-05-25 11:49:49 +03:00
parent da32c7c723
commit 1384cf3c21
3 changed files with 21 additions and 15 deletions

View File

@@ -2,9 +2,9 @@ cmake_minimum_required(VERSION 3.0)
cmake_policy(SET CMP0017 NEW) # need include() with .cmake
project(qad)
set(_QAD_MAJOR 1)
set(_QAD_MINOR 2)
set(_QAD_REVISION 1)
set(_QAD_SUFFIX beta)
set(_QAD_MINOR 3)
set(_QAD_REVISION 0)
set(_QAD_SUFFIX alpha)
set(_QAD_COMPANY SHS)
set(_QAD_DOMAIN org.SHS)

View File

@@ -7,6 +7,15 @@
# include <QScreen>
#endif
#include "session_manager.h"
#include "qad_locations.h"
SessionManager::SessionManager(QString file) {
if (file.isEmpty() && !QCoreApplication::applicationName().isEmpty()) {
file = QAD::userPath(QAD::ltConfig, "session");
}
setFile(file);
}
void SessionManager::setFile(const QString & file) {
@@ -34,7 +43,10 @@ void SessionManager::removeMainWidget(QWidget * e) {
void SessionManager::save() {
if (file_.isEmpty()) return;
if (file_.isEmpty()) {
qDebug() << "[SessionManager] filename is empty";
return;
}
QPIConfig sr(file_);
QObjectList tsc;
for (int i = 0; i < mwindows.size(); ++i) {
@@ -137,19 +149,14 @@ void restoreWindowState(QWidget * w, QPIConfig & sr, QString name) {
srect.y() + (srect.height() - w->height()) / 2,
w->width(), w->height());
}
/*if (w->windowState().testFlag(Qt::WindowMaximized)) {
foreach (QScreen * s, sl) {
if (s->geometry().contains(w->geometry())) {
//w->setGeometry(s->availableGeometry());
break;
}
}
}*/
}
void SessionManager::load(bool onlyMainwindow) {
if (file_.isEmpty()) return;
if (file_.isEmpty()) {
qDebug() << "[SessionManager] filename is empty";
return;
}
QPIConfig sr(file_);
QObjectList tsc;
for (int i = 0; i < mwindows.size(); ++i) {

View File

@@ -47,8 +47,7 @@ class QAD_EXPORT SessionManager: public QObject
{
Q_OBJECT
public:
SessionManager(const QString & file = QString()) {setFile(file);}
~SessionManager() {;}
SessionManager(QString file = QString());
void setFile(const QString & file);